# Definition for singly-linked list.
# class ListNode(object):
#     def __init__(self, val=0, next=None):
#         self.val = val
#         self.next = next
class Solution(object):
    def isPalindrome(self, head):
        """
        :type head: ListNode
        :rtype: bool
        """
        l = []
        while head:
            l.append(head.val)
            head = head.next
        l_len = len(l)
        mid = int(l_len/2)
        if l_len % 2 == 0:
            left = l[:mid]
            right = l[mid:]
        else:
            left = l[:mid]
            right = l[mid+1:]
        right = right[::-1]
        if left == right:
            return True
        return False
